home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7748 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: news.computek.net!usenet
  2. From: robert jacobs and jason jacobs <robertj@computek.net>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: line intersection in C
  5. Date: Wed, 28 Feb 1996 11:39:06 -0600
  6. Organization: Compu-Net DFW's Premiere Internet Access Provider
  7. Message-ID: <3134933A.AB9@computek.net>
  8. References: <1996Feb25.230142.29689@dcs.warwick.ac.uk>
  9. NNTP-Posting-Host: dal834.computek.net
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0 (Win95; I)
  14.  
  15. Daniel Castillo Molero wrote:
  16. > Hello,
  17. > I wonder if anybody can help me to find an algorithm in C to detect whether
  18. > two line segments intersect properly (I don't know if this is the correct
  19. > terminology, but by proper intersection I mean that the intersection is
  20. > not in the extreme of any of them and that one does not lie on top of
  21. > the other).
  22. > I need to test intersection just for line segments whose slope is a multiple
  23. > of 45 degrees, which I suppose may simplify the solution.
  24. > I would greatly appreciate any sort of help.
  25. > Daniel Castillo.
  26. > danmol@dcs.warwick.ac.uk
  27. > --
  28. > * Daniel Castillo.  D.C.Molero@dcs.warwick.ac.uk *
  29.  
  30. Plug the end points of line segements into the equation for a line.
  31. Calculate the slope of the lines.  If the slopes are defferent the lines 
  32. will intersect.
  33.  
  34. Bob Jacobs
  35.